Page({
  data: {
    currentDate: new Date().getTime(),
    minDate: new Date().getTime(),
    pop_show: false,
    defaultObj: {
      title: '营业额',
      leftText: '累计优惠',
      rightText: '服务次数',
      card_bottom: '完成时间'
    },
    itemObj: {
      allcose: '314653',
      times: '2288',
      allDiscount: '2999'
    },
    cardArr: [{
        no: '5232041326541831',
        type: 1,
        data: "2021-05-20",
        time: '13:30:30',
        cost: 200,
      },
      {
        no: '5232041326541831',
        type: 2,
        data: "2021-05-20",
        time: '13:30:30',
        cost: 200,
        note: '这里是备注描述内容'
      },
      {
        no: '5232041326541831',
        type: 1,
        data: "2021-05-20",
        time: '13:30:30',
        cost: 200,
      },
      {
        no: '5232041326541831',
        type: 2,
        data: "2021-05-20",
        time: '13:30:30',
        cost: 200,
        note: '这里是备注描述内容'
      },
      {
        no: '5232041326541831',
        type: 1,
        data: "2021-05-20",
        time: '13:30:30',
        cost: 200,
      },
      {
        no: '5232041326541831',
        type: 2,
        data: "2021-05-20",
        time: '13:30:30',
        cost: 200,
        note: '这里是备注描述内容'
      },
      {
        no: '5232041326541831',
        type: 1,
        data: "2021-05-20",
        time: '13:30:30',
        cost: 200,
      },
      {
        no: '5232041326541831',
        type: 2,
        data: "2021-05-20",
        time: '13:30:30',
        cost: 200,
        note: '这里是备注描述内容'
      },
      {
        no: '5232041326541831',
        type: 1,
        data: "2021-05-20",
        time: '13:30:30',
        cost: 200,
      },
      {
        no: '5232041326541831',
        type: 2,
        data: "2021-05-20",
        time: '13:30:30',
        cost: 200,
        note: '这里是备注描述内容'
      },
      {
        no: '5232041326541831',
        type: 1,
        data: "2021-05-20",
        time: '13:30:30',
        cost: 200,
      },
      {
        no: '5232041326541831',
        type: 2,
        data: "2021-05-20",
        time: '13:30:30',
        cost: 200,
        note: '这里是备注描述内容'
      },
      {
        no: '5232041326541831',
        type: 1,
        data: "2021-05-20",
        time: '13:30:30',
        cost: 200,
      },
      {
        no: '5232041326541831',
        type: 2,
        data: "2021-05-20",
        time: '13:30:30',
        cost: 200,
        note: '这里是备注描述内容'
      },

    ]

  },
  onPopShow() {
    this.setData({
      pop_show: true
    })
  },
  onConfirm(event) {
    // this.setData({
    //   currentDate: event.detail,
    // });
    // console.log(this.data.currentDate)
    //时间戳转换成日期，然后赋值=>显示
    let date = this.getDate(event.detail)
    this.setData({
      currentDate: event.detail,
      dateText: date,
      pop_show: false
    })
    //这里保存时间戳和日期
    //根据时间戳来对数据筛选或者请求刷新数据

  },
  onClose() {
    this.setData({
      pop_show: false
    })
  },

  getDate(n) {
    if (n) {
      var date = new Date(parseInt(n))
    } else {
      var date = new Date()
    }
    var Y = date.getFullYear();
    var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
    let dateText = (Y + "年" + M + "月")
    return dateText
  },

  getCash() {
    //跳转到银行卡界面
  },

  onLoad: function (options) {
    this.setData({
      navHeight: getApp().globalData.navHeight,
      hoverHeight: getApp().globalData.windowHeight - getApp().globalData.navHeight,
      titleHeight: 240 - getApp().globalData.navHeight,
      dateText: this.getDate()
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})